In [2]:
import pandas as pd
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
In [3]:
data = pd.read_csv("apple_products.csv")
In [4]:
data
Out[4]:
Product Name Product URL Brand Sale Price Mrp Discount Percentage Number Of Ratings Number Of Reviews Upc Star Rating Ram
0 APPLE iPhone 8 Plus (Gold, 64 GB) https://www.flipkart.com/apple-iphone-8-plus-g... Apple 49900 49900 0 3431 356 MOBEXRGV7EHHTGUH 4.6 2 GB
1 APPLE iPhone 8 Plus (Space Grey, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVAC6TJT4F 4.6 2 GB
2 APPLE iPhone 8 Plus (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVGETABXWZ 4.6 2 GB
3 APPLE iPhone 8 (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-silver... Apple 77000 77000 0 11202 794 MOBEXRGVMZWUHCBA 4.5 2 GB
4 APPLE iPhone 8 (Gold, 256 GB) https://www.flipkart.com/apple-iphone-8-gold-2... Apple 77000 77000 0 11202 794 MOBEXRGVPK7PFEJZ 4.5 2 GB
... ... ... ... ... ... ... ... ... ... ... ...
57 APPLE iPhone SE (Black, 64 GB) https://www.flipkart.com/apple-iphone-se-black... Apple 29999 39900 24 95909 8161 MOBFWQ6BR3MK7AUG 4.5 4 GB
58 APPLE iPhone 11 (Purple, 64 GB) https://www.flipkart.com/apple-iphone-11-purpl... Apple 46999 54900 14 43470 3331 MOBFWQ6BTFFJKGKE 4.6 4 GB
59 APPLE iPhone 11 (White, 64 GB) https://www.flipkart.com/apple-iphone-11-white... Apple 46999 54900 14 43470 3331 MOBFWQ6BVWVEH3XE 4.6 4 GB
60 APPLE iPhone 11 (Black, 64 GB) https://www.flipkart.com/apple-iphone-11-black... Apple 46999 54900 14 43470 3331 MOBFWQ6BXGJCEYNY 4.6 4 GB
61 APPLE iPhone 11 (Red, 64 GB) https://www.flipkart.com/apple-iphone-11-red-6... Apple 46999 54900 14 43470 3331 MOBFWQ6BYYV3FCU7 4.6 4 GB

62 rows × 11 columns

In [5]:
data.head()
Out[5]:
Product Name Product URL Brand Sale Price Mrp Discount Percentage Number Of Ratings Number Of Reviews Upc Star Rating Ram
0 APPLE iPhone 8 Plus (Gold, 64 GB) https://www.flipkart.com/apple-iphone-8-plus-g... Apple 49900 49900 0 3431 356 MOBEXRGV7EHHTGUH 4.6 2 GB
1 APPLE iPhone 8 Plus (Space Grey, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVAC6TJT4F 4.6 2 GB
2 APPLE iPhone 8 Plus (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVGETABXWZ 4.6 2 GB
3 APPLE iPhone 8 (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-silver... Apple 77000 77000 0 11202 794 MOBEXRGVMZWUHCBA 4.5 2 GB
4 APPLE iPhone 8 (Gold, 256 GB) https://www.flipkart.com/apple-iphone-8-gold-2... Apple 77000 77000 0 11202 794 MOBEXRGVPK7PFEJZ 4.5 2 GB
In [6]:
data.isnull().sum()
Out[6]:
Product Name           0
Product URL            0
Brand                  0
Sale Price             0
Mrp                    0
Discount Percentage    0
Number Of Ratings      0
Number Of Reviews      0
Upc                    0
Star Rating            0
Ram                    0
dtype: int64
In [ ]:
#the dataset does not have any missing value
In [7]:
data.describe()
Out[7]:
Sale Price Mrp Discount Percentage Number Of Ratings Number Of Reviews Star Rating
count 62.000000 62.000000 62.000000 62.000000 62.000000 62.000000
mean 80073.887097 88058.064516 9.951613 22420.403226 1861.677419 4.575806
std 34310.446132 34728.825597 7.608079 33768.589550 2855.883830 0.059190
min 29999.000000 39900.000000 0.000000 542.000000 42.000000 4.500000
25% 49900.000000 54900.000000 6.000000 740.000000 64.000000 4.500000
50% 75900.000000 79900.000000 10.000000 2101.000000 180.000000 4.600000
75% 117100.000000 120950.000000 14.000000 43470.000000 3331.000000 4.600000
max 140900.000000 149900.000000 29.000000 95909.000000 8161.000000 4.700000

top 10 highest rated iphones on Flipkart in India?¶

In [9]:
data.head()
Out[9]:
Product Name Product URL Brand Sale Price Mrp Discount Percentage Number Of Ratings Number Of Reviews Upc Star Rating Ram
0 APPLE iPhone 8 Plus (Gold, 64 GB) https://www.flipkart.com/apple-iphone-8-plus-g... Apple 49900 49900 0 3431 356 MOBEXRGV7EHHTGUH 4.6 2 GB
1 APPLE iPhone 8 Plus (Space Grey, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVAC6TJT4F 4.6 2 GB
2 APPLE iPhone 8 Plus (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVGETABXWZ 4.6 2 GB
3 APPLE iPhone 8 (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-silver... Apple 77000 77000 0 11202 794 MOBEXRGVMZWUHCBA 4.5 2 GB
4 APPLE iPhone 8 (Gold, 256 GB) https://www.flipkart.com/apple-iphone-8-gold-2... Apple 77000 77000 0 11202 794 MOBEXRGVPK7PFEJZ 4.5 2 GB
In [10]:
highest_rated = data.sort_values(by = ["Star Rating"], ascending = False)
highest_rated = highest_rated.head(10)
In [11]:
print(highest_rated['Product Name'])
20     APPLE iPhone 11 Pro Max (Midnight Green, 64 GB)
17         APPLE iPhone 11 Pro Max (Space Grey, 64 GB)
16    APPLE iPhone 11 Pro Max (Midnight Green, 256 GB)
15               APPLE iPhone 11 Pro Max (Gold, 64 GB)
14              APPLE iPhone 11 Pro Max (Gold, 256 GB)
0                    APPLE iPhone 8 Plus (Gold, 64 GB)
29                     APPLE iPhone 12 (White, 128 GB)
32          APPLE iPhone 12 Pro Max (Graphite, 128 GB)
35                     APPLE iPhone 12 (Black, 128 GB)
36                      APPLE iPhone 12 (Blue, 128 GB)
Name: Product Name, dtype: object
In [12]:
print(highest_rated)
                                        Product Name  \
20   APPLE iPhone 11 Pro Max (Midnight Green, 64 GB)   
17       APPLE iPhone 11 Pro Max (Space Grey, 64 GB)   
16  APPLE iPhone 11 Pro Max (Midnight Green, 256 GB)   
15             APPLE iPhone 11 Pro Max (Gold, 64 GB)   
14            APPLE iPhone 11 Pro Max (Gold, 256 GB)   
0                  APPLE iPhone 8 Plus (Gold, 64 GB)   
29                   APPLE iPhone 12 (White, 128 GB)   
32        APPLE iPhone 12 Pro Max (Graphite, 128 GB)   
35                   APPLE iPhone 12 (Black, 128 GB)   
36                    APPLE iPhone 12 (Blue, 128 GB)   

                                          Product URL  Brand  Sale Price  \
20  https://www.flipkart.com/apple-iphone-11-pro-m...  Apple      117100   
17  https://www.flipkart.com/apple-iphone-11-pro-m...  Apple      117100   
16  https://www.flipkart.com/apple-iphone-11-pro-m...  Apple      131900   
15  https://www.flipkart.com/apple-iphone-11-pro-m...  Apple      117100   
14  https://www.flipkart.com/apple-iphone-11-pro-m...  Apple      131900   
0   https://www.flipkart.com/apple-iphone-8-plus-g...  Apple       49900   
29  https://www.flipkart.com/apple-iphone-12-white...  Apple       75900   
32  https://www.flipkart.com/apple-iphone-12-pro-m...  Apple      120900   
35  https://www.flipkart.com/apple-iphone-12-black...  Apple       75900   
36  https://www.flipkart.com/apple-iphone-12-blue-...  Apple       75900   

       Mrp  Discount Percentage  Number Of Ratings  Number Of Reviews  \
20  117100                    0               1078                101   
17  117100                    0               1078                101   
16  131900                    0               1078                101   
15  117100                    0               1078                101   
14  131900                    0               1078                101   
0    49900                    0               3431                356   
29   84900                   10               2101                180   
32  129900                    6                580                 45   
35   84900                   10               2101                180   
36   84900                   10               2101                180   

                 Upc  Star Rating   Ram  
20  MOBFKCTSRYPAQNYT          4.7  4 GB  
17  MOBFKCTSKDMKCGQS          4.7  4 GB  
16  MOBFKCTSCAAKGQV7          4.7  4 GB  
15  MOBFKCTSAPAYNSGG          4.7  4 GB  
14  MOBFKCTS7HCHSPFH          4.7  4 GB  
0   MOBEXRGV7EHHTGUH          4.6  2 GB  
29  MOBFWBYZBTZFGJF9          4.6  6 GB  
32  MOBFWBYZFDGQSDWS          4.6  6 GB  
35  MOBFWBYZK3HACR72          4.6  6 GB  
36  MOBFWBYZKPTZF9VG          4.6  6 GB  

How many rating do the highest rated iPhone on Flipkart have?¶

In [16]:
iphones = highest_rated['Product Name'].value_counts()
label = iphones.index
counts = highest_rated["Number Of Ratings"]
figure = px.bar(highest_rated, x=label, y = counts)
figure.show()

Which iPhone has the highest number of reviews on Flipkart?¶

In [17]:
data.head
Out[17]:
<bound method NDFrame.head of                                 Product Name  \
0          APPLE iPhone 8 Plus (Gold, 64 GB)   
1   APPLE iPhone 8 Plus (Space Grey, 256 GB)   
2       APPLE iPhone 8 Plus (Silver, 256 GB)   
3            APPLE iPhone 8 (Silver, 256 GB)   
4              APPLE iPhone 8 (Gold, 256 GB)   
..                                       ...   
57            APPLE iPhone SE (Black, 64 GB)   
58           APPLE iPhone 11 (Purple, 64 GB)   
59            APPLE iPhone 11 (White, 64 GB)   
60            APPLE iPhone 11 (Black, 64 GB)   
61              APPLE iPhone 11 (Red, 64 GB)   

                                          Product URL  Brand  Sale Price  \
0   https://www.flipkart.com/apple-iphone-8-plus-g...  Apple       49900   
1   https://www.flipkart.com/apple-iphone-8-plus-s...  Apple       84900   
2   https://www.flipkart.com/apple-iphone-8-plus-s...  Apple       84900   
3   https://www.flipkart.com/apple-iphone-8-silver...  Apple       77000   
4   https://www.flipkart.com/apple-iphone-8-gold-2...  Apple       77000   
..                                                ...    ...         ...   
57  https://www.flipkart.com/apple-iphone-se-black...  Apple       29999   
58  https://www.flipkart.com/apple-iphone-11-purpl...  Apple       46999   
59  https://www.flipkart.com/apple-iphone-11-white...  Apple       46999   
60  https://www.flipkart.com/apple-iphone-11-black...  Apple       46999   
61  https://www.flipkart.com/apple-iphone-11-red-6...  Apple       46999   

      Mrp  Discount Percentage  Number Of Ratings  Number Of Reviews  \
0   49900                    0               3431                356   
1   84900                    0               3431                356   
2   84900                    0               3431                356   
3   77000                    0              11202                794   
4   77000                    0              11202                794   
..    ...                  ...                ...                ...   
57  39900                   24              95909               8161   
58  54900                   14              43470               3331   
59  54900                   14              43470               3331   
60  54900                   14              43470               3331   
61  54900                   14              43470               3331   

                 Upc  Star Rating   Ram  
0   MOBEXRGV7EHHTGUH          4.6  2 GB  
1   MOBEXRGVAC6TJT4F          4.6  2 GB  
2   MOBEXRGVGETABXWZ          4.6  2 GB  
3   MOBEXRGVMZWUHCBA          4.5  2 GB  
4   MOBEXRGVPK7PFEJZ          4.5  2 GB  
..               ...          ...   ...  
57  MOBFWQ6BR3MK7AUG          4.5  4 GB  
58  MOBFWQ6BTFFJKGKE          4.6  4 GB  
59  MOBFWQ6BVWVEH3XE          4.6  4 GB  
60  MOBFWQ6BXGJCEYNY          4.6  4 GB  
61  MOBFWQ6BYYV3FCU7          4.6  4 GB  

[62 rows x 11 columns]>
In [18]:
iphones = highest_rated["Product Name"].value_counts()
label = iphones.index
counts = highest_rated["Number Of Reviews"]
figure = px.bar(highest_rated, x=label, y=counts, title="Number of Reviews of Highest Rated iPhones")
figure.show()

What is the relationship between the sales price of iPhones and the number of ratings on Flipkart?¶

In [19]:
data.head()
Out[19]:
Product Name Product URL Brand Sale Price Mrp Discount Percentage Number Of Ratings Number Of Reviews Upc Star Rating Ram
0 APPLE iPhone 8 Plus (Gold, 64 GB) https://www.flipkart.com/apple-iphone-8-plus-g... Apple 49900 49900 0 3431 356 MOBEXRGV7EHHTGUH 4.6 2 GB
1 APPLE iPhone 8 Plus (Space Grey, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVAC6TJT4F 4.6 2 GB
2 APPLE iPhone 8 Plus (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVGETABXWZ 4.6 2 GB
3 APPLE iPhone 8 (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-silver... Apple 77000 77000 0 11202 794 MOBEXRGVMZWUHCBA 4.5 2 GB
4 APPLE iPhone 8 (Gold, 256 GB) https://www.flipkart.com/apple-iphone-8-gold-2... Apple 77000 77000 0 11202 794 MOBEXRGVPK7PFEJZ 4.5 2 GB
In [20]:
figure = px.scatter(data_frame=data, x="Number Of Ratings", y="Sale Price", size="Discount Percentage",
                    trendline="ols", title="Relationship between Sale Price and Number of Ratings")
figure.show()

What is the relationship between the discount percentage and the number of ratings on Flipkart?¶

In [22]:
data.head()
Out[22]:
Product Name Product URL Brand Sale Price Mrp Discount Percentage Number Of Ratings Number Of Reviews Upc Star Rating Ram
0 APPLE iPhone 8 Plus (Gold, 64 GB) https://www.flipkart.com/apple-iphone-8-plus-g... Apple 49900 49900 0 3431 356 MOBEXRGV7EHHTGUH 4.6 2 GB
1 APPLE iPhone 8 Plus (Space Grey, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVAC6TJT4F 4.6 2 GB
2 APPLE iPhone 8 Plus (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVGETABXWZ 4.6 2 GB
3 APPLE iPhone 8 (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-silver... Apple 77000 77000 0 11202 794 MOBEXRGVMZWUHCBA 4.5 2 GB
4 APPLE iPhone 8 (Gold, 256 GB) https://www.flipkart.com/apple-iphone-8-gold-2... Apple 77000 77000 0 11202 794 MOBEXRGVPK7PFEJZ 4.5 2 GB
In [23]:
figure = px.scatter(data_frame=data, x="Number Of Ratings", y="Discount Percentage", size="Sale Price",
                    trendline="ols", title="Relationship between Discount Percentage and Number of Ratings")
figure.show()

Most Expensive and Least Expensive iPhones¶

In [24]:
data.head()
Out[24]:
Product Name Product URL Brand Sale Price Mrp Discount Percentage Number Of Ratings Number Of Reviews Upc Star Rating Ram
0 APPLE iPhone 8 Plus (Gold, 64 GB) https://www.flipkart.com/apple-iphone-8-plus-g... Apple 49900 49900 0 3431 356 MOBEXRGV7EHHTGUH 4.6 2 GB
1 APPLE iPhone 8 Plus (Space Grey, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVAC6TJT4F 4.6 2 GB
2 APPLE iPhone 8 Plus (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-plus-s... Apple 84900 84900 0 3431 356 MOBEXRGVGETABXWZ 4.6 2 GB
3 APPLE iPhone 8 (Silver, 256 GB) https://www.flipkart.com/apple-iphone-8-silver... Apple 77000 77000 0 11202 794 MOBEXRGVMZWUHCBA 4.5 2 GB
4 APPLE iPhone 8 (Gold, 256 GB) https://www.flipkart.com/apple-iphone-8-gold-2... Apple 77000 77000 0 11202 794 MOBEXRGVPK7PFEJZ 4.5 2 GB
In [25]:
most_expensive = data.loc[data['Sale Price'].idxmax()]
least_expensive = data.loc[data['Sale Price'].idxmin()]

# Display the results
print("Most Expensive Product:")
print(most_expensive)

print("\nLeast Expensive Product:")
print(least_expensive)
Most Expensive Product:
Product Name                        APPLE iPhone 12 Pro (Silver, 512 GB)
Product URL            https://www.flipkart.com/apple-iphone-12-pro-s...
Brand                                                              Apple
Sale Price                                                        140900
Mrp                                                               149900
Discount Percentage                                                    6
Number Of Ratings                                                    542
Number Of Reviews                                                     42
Upc                                                     MOBFWBYZ5UY6ZBVA
Star Rating                                                          4.5
Ram                                                                 4 GB
Name: 24, dtype: object

Least Expensive Product:
Product Name                              APPLE iPhone SE (White, 64 GB)
Product URL            https://www.flipkart.com/apple-iphone-se-white...
Brand                                                              Apple
Sale Price                                                         29999
Mrp                                                                39900
Discount Percentage                                                   24
Number Of Ratings                                                  95807
Number Of Reviews                                                   8154
Upc                                                     MOBFWQ6BGWDVGF3E
Star Rating                                                          4.5
Ram                                                                 2 GB
Name: 52, dtype: object